<template>
  <el-form ref="qmGenForm" :model="models" :rules="rules" :disabled="disabled" label-width="80px">
    <el-form-item label="版本号" prop="model.version">
      <el-input v-model="models.model.version" placeholder="请输入版本号" />
    </el-form-item>
    <el-form-item label="版本说明" prop="model.versionDescribe">
      <editor v-model="models.model.versionDescribe" :min-height="192" :disabled="disabled" />
    </el-form-item>
    <el-form-item>
      <qm-uploader
        :dataKey="models.model.versionId || ''"
        :categories="['插件', '示例']"
        :isShowUpload="true"
        :uploadFiles="models.uploadSuccessFiles"
        :disabled="disabled"
      ></qm-uploader>
    </el-form-item>
  </el-form>
</template>

<script>
import Editor from "@/components/Editor";
import QmFileUpload from "@/libs/components/qm-file-upload";
import QmUploader from "@/libs/components/qm-uploader";

export default {
  props: {
    models: Object,
    disabled: Boolean
  },
  components: {
    Editor,
    QmFileUpload,
    QmUploader
  },
  data() {
    return {
      rules: {
        model: {
          version: [
            {
              required: true,
              message: "版本号不能为空",
              trigger: "blur"
            }
          ],
          versionDescribe: [
            {
              required: true,
              message: "版本说明不能为空",
              trigger: "blur"
            }
          ]
        }
      }
    };
  }
};
</script>
